package com.zang.im.croom.web.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.zang.im.croom.service.WsMessageService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author Zhang Qiang
 * @Date 2019/7/29 10:30
 */
@Controller
public class IndexController {

    @GetMapping("/")
    public String room(){
        return "index";
    }

    @Reference
    private WsMessageService wsMessageService;

    @ResponseBody
    @GetMapping("/{id}")
    public String home(@PathVariable(value = "id") Long id){
        if (id == 0){
            id = 99L;
        }
        System.out.println("id :  " + id);
        return "get : " + id;
    }

    @ResponseBody
    @GetMapping("/nacos/{id}")
    public String nacos(@PathVariable(value = "id")Long id){

        return wsMessageService.getWsMeg(id).getMsg();
    }

    @ResponseBody
    @GetMapping("/test")
    public String test(){
        return wsMessageService.test();
    }



}
